import get from '@dfeidao/atom-web/global/get';
import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import fire from '@dfeidao/atom-web/msg/fire';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import error from '@dfeidao/atom-web/msgbox/error';
import hide from '@dfeidao/atom-web/ui/hide';
export default async function a003(fd: IFeidaoAiBrowserComponent) {
	// todo
	const flag = get('flag');
	const nos1 = get('nos');
	if (flag === 1) {
		const res = await nodejs<{ code: 0 | 1; result: string; }>('notification-notice/zj-000005/s002',
			{
				filter: {
					nos: nos1
				}
			});
		if (res.code === 1) {
			alert("删除成功！");
			hide(fd.data.node);
			fire('zj-000001', 'a013');
		} else {
			error("删除失败！");
			hide(fd.data.node);
		}
	}
	if (flag === 2) {
		const res = await nodejs<{ code: 0 | 1; result: string; }>('notification-notice/zj-000005/s003',
			{
				filter: {
					nos: nos1
				}
			});
		const res1 = await nodejs<{ code: 0 | 1; result: string; }>('notification-notice/zj-000005/s004',
			{
				filter: {
					nos: nos1
				}
			});
		const res2 = await nodejs<{ code: 0 | 1; result: string; }>('notification-notice/zj-000005/s005',
			{
				filter: {
					nos: nos1
				}
			});
		if (res.code === 1 || res1.code === 1 || res2.code === 1) {
			alert("删除成功！");
			hide(fd.data.node);
			fire('zj-000001', 'a007');
		} else {
			error("删除失败！");
			hide(fd.data.node);
		}
	}
}
